package com.tqfframe.task.learning.other.inheritance;

import com.tqfframe.task.learning.other.inheritance.entity.Script;

/**
 *  不同类继承调用同一个方法的实现。
 *
 * @Author: 唐祺峰
 * @Date: 2020/7/21 0021 9:45
 * @Version 1.0
 */
public abstract class AfterHandler<T> {

    protected abstract T doAfterHandler(T t);

    public static class DefaultAfterHandler extends AfterHandler<Script>{

        @Override
        protected Script doAfterHandler(Script script) {
            return (Script) AfterHandlerFactory.getAfterHandler(script.getClass()).doAfterHandler(script);
        }
    }

}
